package com.ewanghuiju.app.ui.shopmail.fragment;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.app.Constants;
import com.ewanghuiju.app.base.BaseFragment;
import com.ewanghuiju.app.base.contract.shopmail.FanliOrderListContract;
import com.ewanghuiju.app.model.bean.response.PintuanOrderListResponBean;
import com.ewanghuiju.app.presenter.shopmail.FanliOrderListPresenter;
import com.ewanghuiju.app.test.bean.TestBean;
import com.ewanghuiju.app.ui.pintuan.activity.PintuanOrderDetailsActivity;
import com.ewanghuiju.app.ui.pintuan.adapter.PintuanOrderListAdapter;
import com.ewanghuiju.app.ui.shopmail.adapter.FanliOrderListAdapter;
import com.ewanghuiju.app.util.StartActivityUtil;
import com.flyco.tablayout.listener.CustomTabEntity;

import java.util.ArrayList;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;

/**
 * @author sj  qq:751943509
 * @class 返利订单列表
 * @time 2020/2/28
 */
public class FanliOrderListFragment extends BaseFragment<FanliOrderListPresenter> implements FanliOrderListContract.View {
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;

    private int mType;

    private FanliOrderListAdapter adapter;

    @Override
    protected void initInject() {
        getFragmentComponent().inject(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_fanli_order_list;
    }

    @Override
    protected void initEventAndData() {
        initRecylerView();
    }

    private void initRecylerView() {
        mType = getArguments().getInt(Constants.FANLIORDER_TYPE);
//        recyclerView.setNestedScrollingEnabled(false);
        recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
        adapter = new FanliOrderListAdapter(R.layout.item_fanli_order_list, mType);
        adapter.setNewData(TestBean.getFanliOrderListResponBeanList(5));
        adapter.setHasStableIds(true);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//                PintuanOrderListResponBean bean = (PintuanOrderListResponBean) adapter.getItem(position);
//                new StartActivityUtil(context, PintuanOrderDetailsActivity.class).putExtra(Constants.PINTUANORDER_NO, bean.getId())
//                        .putExtra(Constants.PINTUANORDER_FROM, Constants.PINTUANORDER_FROM_ORDER_LIST)
//                        .startActivity();
            }
        });
        recyclerView.setAdapter(adapter);
    }

    @Override
    public void showContent(String list) {

    }

    @Override
    public void showMoreContent(String list) {

    }

    @Override
    public void initImmersionBar() {
//        super.initImmersionBar();
    }
}
